package com.movitech.mobile.cz.base.supplier.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.movitech.mobile.cz.base.common.util.CommonConstants;
import com.movitech.mobile.cz.base.common.util.StringUtils;
import com.movitech.mobile.cz.base.supplier.entity.SSupplierQualificationGrade;
import com.movitech.mobile.cz.base.supplier.mapper.SSupplierQualificationGradeMapper;
import com.movitech.mobile.cz.base.supplier.service.SSupplierQualificationGradeService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 供方基本情况-资质等级 服务实现类
 * </p>
 *
 * @author Movitech Mobile
 * @since 2018-02-28
 */
@Service("sSupplierQualificationGradeService")
@Transactional
public class SSupplierQualificationGradeServiceImpl extends ServiceImpl<SSupplierQualificationGradeMapper, SSupplierQualificationGrade> implements SSupplierQualificationGradeService {

    @Override
    public String getQualificationNameById(String ids) {
        String qualificationNames = "";
        List<String> lstIds = StringUtils.getListBySplitStr(ids);
        if(CollectionUtils.isNotEmpty(lstIds)){
            for (String id : lstIds) {
                SSupplierQualificationGrade item = selectById(id);
                if(item!=null && StringUtils.isNotEmpty(item.getQualificationName())){
                    if(StringUtils.isNotEmpty(qualificationNames)) qualificationNames += ",";
                    qualificationNames += item.getQualificationName();
                }
            }
        }
        return qualificationNames;
    }
}
